FROM registry.cn-shenzhen.aliyuncs.com/heard/php-nginx:1.5-7.1-1.15.7

MAINTAINER liaoyizhi <liaoyizhi@gmail.com>

ENV ROOT_FOLDER=public \
    APP_DEBUG=true \
    APP_TRACE=true \
    DATABASE_HOSTNAME=mysql \
    DATABASE_DATABASE=fastadmin \
    DATABASE_USERNAME=root \
    DATABASE_PASSWORD=root \
    DATABASE_HOSTPORT=3306 \
    DATABASE_PREFIX="" \
    INIT_DATABASE=false


COPY ./.docker/conf/nginx-rewrite.conf /etc/nginx/conf.d/expand/nginx-rewrite.conf
COPY ./.docker/conf/php-expand.ini /usr/local/etc/php/conf.d/php-expand.ini
COPY . /app/

RUN if [ -f ./composer.json ];then if [ ${COMPOSER_SELF_UPDATE} == true ];then composer self-update; fi; composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction --no-progress; fi \
    && if [[ -f ./bower.json && ${BOWER_AUTO_INSTALL} == true ]];then bower install --allow-root; fi \
    && chown www-data:www-data -R /app

VOLUME ["/app/runtime"]